# redis扩展包
from redis import StrictRedis

class Config():
    # 配置session密钥
    SECRET_KEY = 'KYViJJDlsj7CyaYQxBjgmx3afFv5hqhdEimVzhotAfrVbrvrSF8e8Q=='

    # 配置session信息储存在redis数据库中
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host='127.0.0.1', port=6379, db=1)
    SESSION_USE_SIGNER = True
    # 使用Flask框架内置配置信息,指定session有效期
    PERMANENT_SESSION_LIFETIME = 86400

    # 使用SQLAlchemy扩展包连接mysql数据库
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/news_info'  #
    SQLALCHEMY_TRACK_MODIFICATIONS = True  # 动态跟踪设置,关闭告警信息
    SQLALCHEMY_ECHO = True  # 显示原始sql语句
    DEBUG = None

class DevelopmentConfig(Config):
    DEBUG = True

class ProdictionConfig(Config):
    DEBUG = False

# 不同环境下的字典映射
config_dict= {
    "development" : DevelopmentConfig,
    'prodiction' : ProdictionConfig
}
